﻿<UserControl x:Class="KanbanBoard.Client.View.Views.TaskBoard.TaskView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Converters="clr-namespace:KanbanBoard.Client.View.Converters" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../../Styles/TaskBoard.xaml" />
			</ResourceDictionary.MergedDictionaries>
			<Converters:VisibilityConverter x:Key="VisibilityConverter" />
			<Converters:CommandConverter x:Key="CommandConverter" />
			<Storyboard x:Key="ShowButtons">
				<DoubleAnimation Storyboard.TargetName="Buttons" Storyboard.TargetProperty="Opacity" To="1" BeginTime="0" Duration="0:0:0.5" />
			</Storyboard>
			<Storyboard x:Key="HideButtons">
				<DoubleAnimation Storyboard.TargetName="Buttons" Storyboard.TargetProperty="Opacity" To="0" BeginTime="0" Duration="0:0:1" />
			</Storyboard>
		</ResourceDictionary>
	</UserControl.Resources>

	<Border Style="{StaticResource Task}" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
		<Grid>
			<TextBlock Text="{Binding Path=Description}" Visibility="{Binding DisplayMode, Converter={StaticResource VisibilityConverter}}" Style="{StaticResource TaskDescription}" />
			<TextBox Name="EditDescription" Text="{Binding Path=Description, Mode=TwoWay}" Visibility="{Binding EditMode, Converter={StaticResource VisibilityConverter}}" Style="{StaticResource EditTaskDescription}" />

			<Border BorderThickness="0" Padding="2">
				<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Name="Buttons" Opacity="0">
					<Button Command="{Binding Path=Save, Converter={StaticResource CommandConverter}}" Visibility="{Binding EditMode, Converter={StaticResource VisibilityConverter}}" Style="{StaticResource TaskButton}">S</Button>
					<Button Command="{Binding Path=Edit, Converter={StaticResource CommandConverter}}" Visibility="{Binding DisplayMode, Converter={StaticResource VisibilityConverter}}" Style="{StaticResource TaskButton}">E</Button>
					<Button Command="{Binding Path=Delete, Converter={StaticResource CommandConverter}}" Style="{StaticResource TaskButton}" Foreground="Red">X</Button>
				</StackPanel>
			</Border>
		</Grid>
	</Border>
</UserControl>